package com.yami.shop.user.common.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yami.shop.bean.dto.ShopWithdrawCashConfigDto;
import com.yami.shop.bean.model.ShopWithdrawCash;
import com.yami.shop.bean.model.User;
import com.yami.shop.bean.vo.UserBalanceWithdrawCashConfigVO;
import com.yami.shop.security.common.model.AppConnect;
import com.yami.shop.user.common.dto.UserBalanceWithdrawCashDto;
import com.yami.shop.user.common.dto.UserBalanceWithdrawCashSetDto;
import com.yami.shop.user.common.model.UserBalanceWithdrawCash;
import com.yami.shop.user.common.param.RangeTimeParam;
import com.yami.shop.user.common.param.UserBalanceWithdrawCashSaceParam;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;

/**
 * @author lgh on 2019/04/01.
 */
public interface UserBalanceWithdrawCashService extends IService<UserBalanceWithdrawCash> {

    /**
     * 分页获取用户提现申请记录
     * @param page 分页参数
     * @param rangeTimeParam 申请时间
     * @param userMobile 手机号
     * @param userBalanceWithdrawCash 查询参数
     * @return 用户提现申请记录
     */
    IPage<UserBalanceWithdrawCash> userBalanceWithdrawCashsPage(Page page, RangeTimeParam rangeTimeParam, String userMobile,String userName, UserBalanceWithdrawCash userBalanceWithdrawCash);

    /**
     * 分页获取用户提现申请记录
     * @param page 分页参数
     * @param userId 用户id
     * @return 用户提现申请记录
     */
    IPage<UserBalanceWithdrawCashDto> userBalanceWithdrawCashDtoPageByUserId(Page page, String userId);


    /**
     * 发起提现申请
     * @param userBalanceWithdrawCashSaceParam 申请数据
     * @param user 用户信息
     */
    Map<String,Object> apply(UserBalanceWithdrawCashSaceParam userBalanceWithdrawCashSaceParam, User user);

    /**
     * 审核提现记录
     * @param withdrawCashId 提现id
     * @param userBalanceWithdrawCash 提现参数
     * @param userId 用户id
     * @param openId 第三方id
     */
    void auditWithdrawCash(Long withdrawCashId, UserBalanceWithdrawCash userBalanceWithdrawCash, Long userId, String openId);


    /**
     * 提现打款异步通知
     *
     * @param request 异步通知数据
     */
    void auditNotice(HttpServletRequest request,Long balanceLogId);

    /**
     * 根据时间区间获取用户的提现次数
     *
     * @param rangeTimeParam 时间范围
     * @param userId 用户id
     * @return 获取用户的提现次数
     */
    Integer getCountByRangeTimeAndUserId(RangeTimeParam rangeTimeParam, String userId);

    /**
     * 查看用户总提现金额
     * @param walletId 钱包id
     * @return 总提现金额
     */
    Double getUserTotalWithdrawCash(Long walletId);

    /**
     * 保存提现配置
     * @param userBalanceWithdrawCashSetDto
     */
    void saveConfig(UserBalanceWithdrawCashSetDto userBalanceWithdrawCashSetDto);

    /**
     * 获取提现配置
     * @return
     */
    UserBalanceWithdrawCashConfigVO getConfig();

    /**
     * 获取筛选条件筛选的提现信息
     * @param userBalanceWithdrawCash
     * @return
     */
    void exportShopWithdrawCash(UserBalanceWithdrawCash userBalanceWithdrawCash, HttpServletResponse response);


}
